/*
 * 字典
 */
import { postRequest, getRequest } from '/@/lib/axios';

export const dictApi = {

  // 获取所有字典code
  getAllDict: () => {
    return getRequest('/sys/dict/getAllDict');
  },

  // 获取全部字典数据
  getAllDictData: () => {
    return getRequest('/sys/dict/getAllDictData');
  },

  // 分页查询
  queryDict: (param) => {
    return postRequest('/sys/dict/queryPage', param);
  },

  // 添加 
  addDict: (param) => {
    return postRequest('/sys/dict/add', param);
  },

  // 更新
  updateDict: (param) => {
    return postRequest('/sys/dict/update', param);
  },

  // 字典-删除-
  batchDeleteDict: (dictIdList) => {
    return postRequest('/sys/dict/batchDelete', dictIdList);
  },

  // 字典 启用 禁用
  updateDisabled: (dictId) => {
    return getRequest(`/sys/dict/updateDisabled/${dictId}`);
  },

  // ------------- 查询字典数据 -------------

  // 字典数据 分页查询
  queryDictData: (dictId) => {
    return getRequest(`/sys/dict/dictData/queryDictData/${dictId}`);
  },

  // 字典数据 添加
  addDictData: (param) => {
    return postRequest('/sys/dict/dictData/add', param);
  },

  // 字典数据 更新
  updateDictData: (param) => {
    return postRequest('/sys/dict/dictData/update', param);
  },

  // 字典数据-删除
  batchDeleteDictData: (dictDataIdList) => {
    return postRequest('/sys/dict/dictData/batchDelete', dictDataIdList);
  },

  // 字典数据 启用 禁用
  updateDictDataDisabled: (dictDataId) => {
    return getRequest(`/sys/dict/dictData/updateDisabled/${dictDataId}`);
  },
};
